<?php

/**
 * MyHammer IndexedMemcache
 *
 * LICENSE
 *
 * This source file is subject to the GNU General Public License Version 3
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.myhammer.de/opensource/license/gpl.txt
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to opensource@myhammer.de so we can send you a copy immediately.
 *
 * @category   MyHammer
 * @package    MyHammer_IndexedMemcache
 * @subpackage Memcache
 * @license    http://www.myhammer.de/opensource/license/gpl.txt GNU General Public License Version 3
 * @version    1.0
 * @author     Steven Berg <berg@myhammer.de>
 */

abstract class cMemCacheModel {

    private $sGuId = NULL;
    private $aData = array();
    private $iLinkId = 0;

    /**
     * get GuId
     *
     * @return string
     */
    public function getGuId() {
        if (is_null($this->sGuId)) {
            $this->sGuId = uniqid(cConfigMemCache::IDENTIFIER_MEMDB_PREFIX);
        }
        return $this->sGuId;
    }

    /**
     * set GuId
     *
     * @param string $sGuId
     */
    public function setGuId($sGuId) {
        $this->sGuId = $sGuId;
    }

    /**
     * set LinkId
     *
     * @param integer $iLinkId
     */
    public function setLinkId($iLinkId) {
        $this->iLinkId = $iLinkId;
    }

    /**
     * get LinkId
     *
     * @return integer
     */
    public function getLinkId() {
        return $this->iLinkId;
    }

    /**
     * add Data
     *
     * @param string $sKey
     * @param mixed $mValue
     */
    public function addData($sKey, $mValue) {
        $this->aData[$sKey] = $mValue;
    }

    /**
     * get Data
     *
     * @param string $sKey
     * @return mixed
     */
    public function getData($sKey) {
        return $this->aData[$sKey];
    }

    /**
     * set Data
     *
     * @param array $aData
     */
    public function setData($aData) {
        $this->aData = $aData;
    }


    /**
     * get Columns
     *
     * @return array
     */
    public function getColumns() {
        return $this->aData;
    }

    /**
     * get Classname
     *
     * @return string
     */
    public function getClassName() {
        return get_class($this);
    }
}